<%@page import="com.pb.poem.entity.Poem"%>
<%@page import="java.util.List"%>
<%@page import="com.pb.poem.util.Page"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@include file="../common/common.jsp" %>

<%
String currentPage = request.getParameter("pageIndex");
if (currentPage == null)
	currentPage = "1";
int pageIndex = Integer.parseInt(currentPage);
//当前页码
//int pageIndex=1;           //获取当前内容
int totalCount = poemService.getTotalProCount();
//获取新闻总量
int pageSize = 3;//每页显示几条
Page pages = new Page();
pages.setPageSize(pageSize);
pages.setRecordCount(totalCount);
int totalPage = pages.getTotalPageCount();//获取总页数
pages.setCurrPageNo(pageIndex);
pageIndex=pages.getCurrPageNo();
 //控制首页和末页
   if(pageIndex<1){
	   pageIndex=1;
   }else if(pageIndex>totalPage){
	   pageIndex=totalPage;
   } 
//每页显示的新闻列表
List<Poem> poemList = poemService.getPagePoemList(pageIndex, pageSize);
request.setAttribute("List", poemList);
request.setAttribute("pageIndex", pageIndex);
request.setAttribute("totalCount", totalCount);
request.setAttribute("totalPage", totalPage);
%> 
<jsp:forward page="show2.jsp" />
